# Copyright (c) 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
# pylint: disable=all
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2

import neural_solution.frontend.gRPC.proto.neural_solution_pb2 as neural__solution__pb2


class TaskServiceStub(object):
    """Interface exported by the server."""

    def __init__(self, channel):
        """Init constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Ping = channel.unary_unary(
            "/neural_solution.TaskService/Ping",
            request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            response_deserializer=neural__solution__pb2.ResponsePingMessage.FromString,
        )
        self.SubmitTask = channel.unary_unary(
            "/neural_solution.TaskService/SubmitTask",
            request_serializer=neural__solution__pb2.Task.SerializeToString,
            response_deserializer=neural__solution__pb2.TaskResponse.FromString,
        )
        self.GetTaskById = channel.unary_unary(
            "/neural_solution.TaskService/GetTaskById",
            request_serializer=neural__solution__pb2.TaskId.SerializeToString,
            response_deserializer=neural__solution__pb2.TaskStatus.FromString,
        )
        self.QueryTaskResult = channel.unary_unary(
            "/neural_solution.TaskService/QueryTaskResult",
            request_serializer=neural__solution__pb2.TaskId.SerializeToString,
            response_deserializer=neural__solution__pb2.ResponseTaskResult.FromString,
        )


class TaskServiceServicer(object):
    """Interface exported by the server."""

    def Ping(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SubmitTask(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetTaskById(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def QueryTaskResult(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_TaskServiceServicer_to_server(servicer, server):
    """Add the TaskServiceServicer to gRpc server.

    Args:
        servicer (TaskSubmitterServicer): task servicer
        server (grpc._server._Server): server
    """
    rpc_method_handlers = {
        "Ping": grpc.unary_unary_rpc_method_handler(
            servicer.Ping,
            request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            response_serializer=neural__solution__pb2.ResponsePingMessage.SerializeToString,
        ),
        "SubmitTask": grpc.unary_unary_rpc_method_handler(
            servicer.SubmitTask,
            request_deserializer=neural__solution__pb2.Task.FromString,
            response_serializer=neural__solution__pb2.TaskResponse.SerializeToString,
        ),
        "GetTaskById": grpc.unary_unary_rpc_method_handler(
            servicer.GetTaskById,
            request_deserializer=neural__solution__pb2.TaskId.FromString,
            response_serializer=neural__solution__pb2.TaskStatus.SerializeToString,
        ),
        "QueryTaskResult": grpc.unary_unary_rpc_method_handler(
            servicer.QueryTaskResult,
            request_deserializer=neural__solution__pb2.TaskId.FromString,
            response_serializer=neural__solution__pb2.ResponseTaskResult.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler("neural_solution.TaskService", rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class TaskService(object):
    """Interface exported by the server."""

    @staticmethod
    def Ping(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        """Tets server status.

        Args:
        request: An iterator that yields request values for the RPC.
        target: The server address.
        method: The name of the RPC method.
        request_serializer: Optional :term:`serializer` for serializing the request
                message. Request goes unserialized in case None is passed.
        response_deserializer: Optional :term:`deserializer` for deserializing the response
                message. Response goes undeserialized in case None is passed.
        options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
                runtime) to configure the channel.
        channel_credentials: A credential applied to the whole channel, e.g. the
                return value of grpc.ssl_channel_credentials() or
                grpc.insecure_channel_credentials().
        insecure: If True, specifies channel_credentials as
                :term:`grpc.insecure_channel_credentials()`. This option is mutually
                exclusive with the `channel_credentials` option.
        call_credentials: A call credential applied to each call individually,
                e.g. the output of grpc.metadata_call_credentials() or
                grpc.access_token_call_credentials().
        compression: An optional value indicating the compression method to be
                used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
        wait_for_ready: An optional flag indicating whether the RPC should fail
                immediately if the connection is not ready at the time the RPC is
                invoked, or if it should wait until the connection to the server
                becomes ready. When using this option, the user will likely also want
                to set a timeout. Defaults to True.
        timeout: An optional duration of time in seconds to allow for the RPC,
                after which an exception will be raised. If timeout is unspecified,
                defaults to a timeout controlled by the
                GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
                unset, defaults to 60 seconds. Supply a value of None to indicate that
                no timeout should be enforced.
        metadata: Optional metadata to send to the server.

        Returns:
        The response to the RPC.
        """
        return grpc.experimental.unary_unary(
            request,
            target,
            "/neural_solution.TaskService/Ping",
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            neural__solution__pb2.ResponsePingMessage.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def SubmitTask(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        """Submit task.

        Args:
        request: An iterator that yields request values for the RPC.
        target: The server address.
        method: The name of the RPC method.
        request_serializer: Optional :term:`serializer` for serializing the request
                message. Request goes unserialized in case None is passed.
        response_deserializer: Optional :term:`deserializer` for deserializing the response
                message. Response goes undeserialized in case None is passed.
        options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
                runtime) to configure the channel.
        channel_credentials: A credential applied to the whole channel, e.g. the
                return value of grpc.ssl_channel_credentials() or
                grpc.insecure_channel_credentials().
        insecure: If True, specifies channel_credentials as
                :term:`grpc.insecure_channel_credentials()`. This option is mutually
                exclusive with the `channel_credentials` option.
        call_credentials: A call credential applied to each call individually,
                e.g. the output of grpc.metadata_call_credentials() or
                grpc.access_token_call_credentials().
        compression: An optional value indicating the compression method to be
                used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
        wait_for_ready: An optional flag indicating whether the RPC should fail
                immediately if the connection is not ready at the time the RPC is
                invoked, or if it should wait until the connection to the server
                becomes ready. When using this option, the user will likely also want
                to set a timeout. Defaults to True.
        timeout: An optional duration of time in seconds to allow for the RPC,
                after which an exception will be raised. If timeout is unspecified,
                defaults to a timeout controlled by the
                GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
                unset, defaults to 60 seconds. Supply a value of None to indicate that
                no timeout should be enforced.
        metadata: Optional metadata to send to the server.

        Returns:
        The response to the RPC.
        """
        return grpc.experimental.unary_unary(
            request,
            target,
            "/neural_solution.TaskService/SubmitTask",
            neural__solution__pb2.Task.SerializeToString,
            neural__solution__pb2.TaskResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def GetTaskById(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        """Get task status according to id.

        Args:
        request: An iterator that yields request values for the RPC.
        target: The server address.
        method: The name of the RPC method.
        request_serializer: Optional :term:`serializer` for serializing the request
                message. Request goes unserialized in case None is passed.
        response_deserializer: Optional :term:`deserializer` for deserializing the response
                message. Response goes undeserialized in case None is passed.
        options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
                runtime) to configure the channel.
        channel_credentials: A credential applied to the whole channel, e.g. the
                return value of grpc.ssl_channel_credentials() or
                grpc.insecure_channel_credentials().
        insecure: If True, specifies channel_credentials as
                :term:`grpc.insecure_channel_credentials()`. This option is mutually
                exclusive with the `channel_credentials` option.
        call_credentials: A call credential applied to each call individually,
                e.g. the output of grpc.metadata_call_credentials() or
                grpc.access_token_call_credentials().
        compression: An optional value indicating the compression method to be
                used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
        wait_for_ready: An optional flag indicating whether the RPC should fail
                immediately if the connection is not ready at the time the RPC is
                invoked, or if it should wait until the connection to the server
                becomes ready. When using this option, the user will likely also want
                to set a timeout. Defaults to True.
        timeout: An optional duration of time in seconds to allow for the RPC,
                after which an exception will be raised. If timeout is unspecified,
                defaults to a timeout controlled by the
                GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
                unset, defaults to 60 seconds. Supply a value of None to indicate that
                no timeout should be enforced.
        metadata: Optional metadata to send to the server.

        Returns:
        The response to the RPC.
        """
        return grpc.experimental.unary_unary(
            request,
            target,
            "/neural_solution.TaskService/GetTaskById",
            neural__solution__pb2.TaskId.SerializeToString,
            neural__solution__pb2.TaskStatus.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def QueryTaskResult(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        """Get task result according to id.

        Args:
        request: An iterator that yields request values for the RPC.
        target: The server address.
        method: The name of the RPC method.
        request_serializer: Optional :term:`serializer` for serializing the request
                message. Request goes unserialized in case None is passed.
        response_deserializer: Optional :term:`deserializer` for deserializing the response
                message. Response goes undeserialized in case None is passed.
        options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core
                runtime) to configure the channel.
        channel_credentials: A credential applied to the whole channel, e.g. the
                return value of grpc.ssl_channel_credentials() or
                grpc.insecure_channel_credentials().
        insecure: If True, specifies channel_credentials as
                :term:`grpc.insecure_channel_credentials()`. This option is mutually
                exclusive with the `channel_credentials` option.
        call_credentials: A call credential applied to each call individually,
                e.g. the output of grpc.metadata_call_credentials() or
                grpc.access_token_call_credentials().
        compression: An optional value indicating the compression method to be
                used over the lifetime of the channel, e.g. grpc.Compression.Gzip.
        wait_for_ready: An optional flag indicating whether the RPC should fail
                immediately if the connection is not ready at the time the RPC is
                invoked, or if it should wait until the connection to the server
                becomes ready. When using this option, the user will likely also want
                to set a timeout. Defaults to True.
        timeout: An optional duration of time in seconds to allow for the RPC,
                after which an exception will be raised. If timeout is unspecified,
                defaults to a timeout controlled by the
                GRPC_PYTHON_DEFAULT_TIMEOUT_SECONDS environment variable. If that is
                unset, defaults to 60 seconds. Supply a value of None to indicate that
                no timeout should be enforced.
        metadata: Optional metadata to send to the server.

        Returns:
        The response to the RPC.
        """
        return grpc.experimental.unary_unary(
            request,
            target,
            "/neural_solution.TaskService/QueryTaskResult",
            neural__solution__pb2.TaskId.SerializeToString,
            neural__solution__pb2.ResponseTaskResult.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )
